import { DefinitionItem, DeviceTypeItem } from "./models";
import req, { RequsetOptons } from "/@/api/req";

export const Api = {
  tollGatesPage: "civilized/toll-gates/",
  tollCollectorsPage: "civilized/toll-collectors/",
  devicesPage: "civilized/devices/",
  tollCollectorsExport: "civilized/toll-collectors/export",
  devicesExport: "civilized/devices/export",
  deviceType: "civilized/device-type",
  tollBooths: "civilized/toll-booths",
  definition: "civilized/service-definition",
  serviceManagement: "civilized/service-management/",
  serviceManagementExport: "civilized/service-management/export",
  serviceManagementImport: "civilized/service-management/import",
};

export function getDeviceType() {
  return req.commonGet<DeviceTypeItem[]>(Api.deviceType, null, { useGlobalLoading: false });
}

export function getDef(serviceDefinitionType) {
  return req.commonGet<DefinitionItem>(Api.definition, { serviceDefinitionType });
}

export function updateDef(data: DefinitionItem) {
  return req.put({
    url: Api.definition,
    data,
  });
}
